﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Farigola.Engine.SystemData.DataValue;

namespace Farigola.Engine.SystemData.Entity.inst
{
    /// <summary>
    /// Represents a string data value entity. 
    /// </summary>
    public class EntInstString : EntInstBasicBase
    {
        /// <summary>
        /// the string data value of the entity.
        /// </summary>
        private DataValueString _dataValue;

        //=====================================================================
        #region Constructors.

        //---------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="systOrUser"></param>
        /// <param name="id"></param>
        /// <param name="name"></param>
        public EntInstString(EntityDef.TypeSystOrUser systOrUser, EntityId id, String name)
            : base(systOrUser, id, name)
        {            
            // create the data value
            _dataValue = new DataValueString();
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        public EntInstString(EntityId id, String name)
            : base(id, name)
        {            
        }

        #endregion

        //---------------------------------------------------------------------
        /// <summary>
        /// Get the inner data value string of the entity.
        /// </summary>
        /// <returns></returns>
        public DataValueString GetDataValueString()
        {
            return _dataValue;
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Set the data value string to the entity instance string.
        /// Replace the previous data value.
        /// </summary>
        /// <param name="dv"></param>
        /// <returns></returns>
        public bool SetDataValueString(DataValueString dv)
        {
            if (dv == null)
                return false;
            _dataValue = dv;
            return true;
        }
    }
}
